<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<%
	//임의로 세션기록
	session.setAttribute("id", "admin");
	String id = (String)session.getAttribute("id");
	String idOK="admin"; //관리자 비교 아이디
%>
<%@include file="/WEB-INF/Top.jsp" %>
<script language="JavaScript">
	function addgo(){
		location.href="addgo";
	}
	function deletego(num){
		location.href="delete?num="+num+"";
	}
	//function updatego(num,subject,content){
		//location.href="updatego?num="+num+"&subject="+subject+"&content="+content+"";
		function updatego(num){
		location.href="updatego?num="+num;
	}
</script>
</head>
<body>
<br><br>
<table width="570" border="0" align="center">
	<%if(id.equals(idOK)){ %>
		<tr><td align="right"><input type="button" value="이벤트추가" onClick="addgo()"></td></tr>
	<%}%>
	<tr>
		<td>
		<hr size="1" width="570" color="#CCCCCC">
		<c:if test="${list.size() ==0 }">
		<p align="center"><font color=#CCCCCC>진행중인 이벤트가 없습니다.</font></p>
		</c:if>
		<center>
		<c:if test="${list.size() !=0 }">
		<c:forEach items="${list }" var="list">
		<div style="width:570px;">
    	<hr>
		<table border="0">
        	<tr>
        		<td><a href="/food/event/view?img2=${list.EVENT_IMAGENAME2 }"><img src="<%=eventimg%>${list.EVENT_IMAGENAME1}" width="310" height="119" border="0" align="top"></a></td>
            	<td width="260">
                <p align="center"><a href="/food/event/view?img2=${list.EVENT_IMAGENAME2 }">${list.EVENT_SUBJECT }</a></p>
                <p align="center">${list.EVENT_CONTENT}</p>
                <p align="center">${list.EVENT_DATE}</p>
                <%if(id.equals(idOK)){ %>
                	<!-- <input type="button" value="수정" onClick="updatego('${list.EVENT_NUM }','${list.EVENT_SUBJECT }','${list.EVENT_CONTENT}')">-->
                	<input type="button" value="수정" onClick="updatego('${list.EVENT_NUM }')">
                	<input type="button" value="삭제" onClick="deletego(${list.EVENT_NUM })">
                <%}%>
				</td>
       		</tr>
		</table>
   		<hr>
		</div>
		</c:forEach>
		</c:if>
		</center>
		<hr size="1" width="570" color="#CCCCCC">
		</td>
	</tr>
</table>
</body>
</html>